{%  extends 'base/base.html' %}
{% block title %}
首页
{% endblock %}


{% block main %}
<h1>列表</h1>
{#    {{ page_obj }}#}
{#    {{ is_paginated }}#}
{#    {{ paginator }}#}
    {% for u in page_obj %}
    <li><a href="{% url 'user:action' u.id %}">{{ u.name }}</a>
{#        {% if  %}#}
        <a class="btn btn-info " href="{% url 'user:change' u.id %}">修改</a>
        <a class="btn btn-danger" href="{% url 'user:delete' u.id %}">删除</a>
    </li>
    {% endfor %}
    <nav aria-label="Page navigation">
  <ul class="pagination">
    {% if page_obj.has_previous %}
        <li>
        <a href="?page={{ page_obj.previous_page_number }}" aria-label="Previous">
    {% else %}
        <li class="disabled">
         <a href="#" aria-label="Previous">
    {% endif %}


        <span aria-hidden="true">&laquo;</span>
      </a>
    </li>
    {% for p in paginator.page_range %}
        {% if p == page.paginator.name_pages %}
        <li><a class="active" href="">{{ p }}</a></li>
        {% else %}
        <li><a  href="http://127.0.0.1:8000/?page={{ p }}">{{ p }}</a></li>
        {% endif %}
    {% endfor %}
     {% if page_obj.has_next %}
         <li>
          <a href="?page={{ page_obj.next_page_number }}" aria-label="Next">
     {% else %}
         <li class="disabled">
          <a href="" aria-label="Next">
      {% endif %}
        <span aria-hidden="true">&raquo;</span>
      </a>
    </li>
  </ul>

</nav>


{% endblock %}